package com.neuedu.autosale.sys.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.neuedu.autosale.entity.Pager;
import com.neuedu.autosale.entity.Result;

import com.neuedu.autosale.mapper.StorageMapper;
import com.neuedu.autosale.sys.entity.Storage;
import com.neuedu.autosale.sys.service.StorageService;

@Service
@Transactional
public class StorageServiceImpl implements StorageService{
	
	@Autowired
	private  StorageMapper storageMapper;
	@Override
	public List<Storage> findListByPager(Pager<Storage> pager) {
		
		return storageMapper.findListBypager(pager);
	}

	@Override
	public Integer findTotalByPager(Pager<Storage> pager) {
		
		return storageMapper.findTotalByPager(pager);
	}

	@Override
	public Result add(Storage object) {
		Result result = new Result(false, "新增失败");
		boolean ret = storageMapper.add(object);
		if (ret) {
			result = new Result(true, "新增成功");
		}
		return result;
	}

	@Override
	public Result edit(Storage object) {
		Result result = new Result(false, "修改失败");
		boolean ret = storageMapper.edit(object);
		if (ret) {
			result = new Result(true, "修改成功");
		}
		return result;
	}

	@Override
	public Result deleteByIds(List<Storage> ids) {
		Result result = new Result(false, "删除失败");
		boolean ret = storageMapper.deleteByIds(ids);
		if (ret) {
			result = new Result(true, "删除成功");
		}
		return result;
	}

	@Override
	public List<Storage> findAll() {
		return storageMapper.findAll();
	}

}
